package top.fzqblog.clazz

/**
 * Created by 抽离 on 2017/7/29 0029.
 */
/**
 * 默认都是final，只有标记为open才能被继承
 */
open class ClassTest01(val age : Int, val name : String){

    init {
        println("年纪：" + age)
    }

    open fun say(){
        println("say：" + "啦啦啦")
    }

    override fun toString(): String {
        return """
        age：  $age
        name：  $name
        """
    }
}


class extends(age: Int, name: String, sex: Int) : ClassTest01(age, name) {

    init {
        println("age：" + age + "\n" + "name：" + name)
    }

    override fun say(){
        println("子类say：" + "啦啦啦")
    }
}

fun main(args: Array<String>) {
    println(extends(1, "张三", 1).say())
}